import { BasicColumn } from '/@/components/Table/src/types/table';
import { FormProps } from '/@/components/Table';
import { FormSchema } from '/@/components/Form';
import { useI18n } from '/@/hooks/web/useI18n';
import { Getallpersondto } from '/@/api/demo/system';

const { t } = useI18n();
/**
 * 模块名:发布区表格数据列
 * 代码描述:
 * 作者:张泽源
 * 创建时间:2024/12/17 10:52:50
 */
export function getReleaseColumns(): BasicColumn[] {
  return [
    {
      title: t('routes.table.documentReleaseArea.versionList.documentCode'),
      dataIndex: 'thitObjectId',
      fixed: 'left',
      align: 'left',
      width: 300,
    },
    {
      title: t('routes.table.documentReleaseArea.ReleaseList.documentName'),
      dataIndex: 'docName',
      align: 'left',
      width: 200,
    },
    {
      title: t('routes.table.documentReleaseArea.ReleaseList.documentType'),
      dataIndex: 'docType',
      width: 150,
      align: 'left',
    },
    {
      title: t('routes.table.documentReleaseArea.ReleaseList.status'),
      dataIndex: 'status',
      width: 100,
      align: 'left',
      slots: { customRender: 'status' },
    },
    {
      title: t('routes.table.documentReleaseArea.ReleaseList.creator'),
      dataIndex: 'creater',
      width: 100,
      align: 'left',
    },
    {
      title: t('routes.table.documentReleaseArea.ReleaseList.createTime'),
      dataIndex: 'createTime',
      width: 150,
      align: 'left',
      slots: { customRender: 'createTime' },
    },
    {
      title: t('routes.table.documentReleaseArea.ReleaseList.lifecycle'),
      dataIndex: 'lifecycle',
      width: 100,
      align: 'left',
      slots: { customRender: 'lifecycle' },
    },
    {
      title: t('routes.table.documentReleaseArea.ReleaseList.version'),
      dataIndex: 'docVersion',
      width: 100,
      align: 'left',
    },
    {
      title: t('routes.table.documentReleaseArea.ReleaseList.fileSize'),
      dataIndex: 'fileSize',
      width: 120,
      align: 'left',
    },
    {
      title: t('routes.table.documentReleaseArea.ReleaseList.endTime'),
      dataIndex: 'lookDeadTime',
      width: 150,
      align: 'left',
      slots: { customRender: 'lookDeadTime' },
    },
    {
      title: t('routes.table.documentReleaseArea.ReleaseList.publisher'),
      dataIndex: 'fUserId',
      width: 100,
      align: 'left',
    },
    {
      title: t('routes.table.documentReleaseArea.ReleaseList.releaseTime'),
      dataIndex: 'releaseTime',
      width: 150,
      align: 'left',
      slots: { customRender: 'releaseTime' },
    },
    {
      title: t('routes.table.documentReleaseArea.ReleaseList.receiver'),
      dataIndex: 'sUserId',
      width: 100,
      align: 'left',
    },
    {
      title: t('routes.table.documentReleaseArea.ReleaseList.orderNumber'),
      dataIndex: 'order',
      width: 200,
      align: 'left',
    },
  ];
}

/**
 * 模块名:发布搜索
 * 代码描述:
 * 作者:张泽源
 * 创建时间:2024/12/17 11:23:57
 */
export function getReleaseConfig(): Partial<FormProps> {
  return {
    labelWidth: 100,
    colon: true, // 是否显示冒号
    schemas: [
      {
        field: `IdOrName`,
        label: t('routes.table.documentReleaseArea.ReleaseList.documentName'),
        component: 'Input',
        colProps: {
          xl: 12,
          xxl: 8,
        },
        componentProps: {
          placeholder: t('routes.table.documentReleaseArea.ReleaseList.documentNamePlaceholder'),
        },
      },
      {
        field: `fUserId`,
        label: t('routes.table.documentReleaseArea.ReleaseList.publisher'),
        component: 'ApiSelect',
        colProps: {
          xl: 12,
          xxl: 8,
        },
        componentProps: {
          placeholder: t('routes.table.documentReleaseArea.ReleaseList.publisherPlaceholder'),
          api: Getallpersondto,
          labelField: 'name',
          valueField: 'id',
        },
      },
      {
        field: `sUserId`,
        label: t('routes.table.documentReleaseArea.ReleaseList.receiver'),
        component: 'ApiSelect',
        colProps: {
          xl: 12,
          xxl: 8,
        },
        componentProps: {
          placeholder: t('routes.table.documentReleaseArea.ReleaseList.receiverPlaceholder'),
          api: Getallpersondto,
          labelField: 'name',
          valueField: 'id',
        },
      },
      {
        field: `releaseTime`,
        label: t('routes.table.documentReleaseArea.ReleaseList.startTime'),
        component: 'DatePicker',
        colProps: {
          xl: 12,
          xxl: 8,
        },
      },
      {
        field: `endTime`,
        label: t('routes.table.documentReleaseArea.ReleaseList.endTime'),
        component: 'DatePicker',
        colProps: {
          xl: 12,
          xxl: 8,
        },
      },
    ],
  };
}

/**
 * 模块名:发布区历史版本
 * 代码描述:
 * 作者:张泽源
 * 创建时间:2024/12/19 08:58:56
 */
export function getHistoryColumns(): BasicColumn[] {
  return [
    {
      title: t('routes.table.documentReleaseArea.versionList.documentCode'),
      dataIndex: 'ThitObjectId',
      fixed: 'left',
      width: 200,
    },
    {
      title: t('routes.table.documentReleaseArea.versionList.documentName'),
      dataIndex: 'name',
      width: 150,
    },
    {
      title: t('routes.table.documentReleaseArea.versionList.version'),
      dataIndex: 'version',
      width: 100,
    },
    {
      title: t('routes.table.documentReleaseArea.versionList.creator'),
      dataIndex: 'creater',
      width: 100,
    },
    {
      title: t('routes.table.documentReleaseArea.versionList.createTime'),
      dataIndex: 'createtime',
      width: 150,
      slots: { customRender: 'createtime' },
    },
    {
      title: t('routes.table.documentReleaseArea.versionList.sourceFileName'),
      dataIndex: 'filename',
      width: 200,
    },
    {
      title: t('routes.table.documentReleaseArea.versionList.securityLevel'),
      dataIndex: 'securitylevel',
      width: 100,
    },
    {
      title: t('routes.table.documentReleaseArea.versionList.fileType'),
      dataIndex: 'status',
      width: 100,
      slots: { customRender: 'status' },
    },
  ];
}

/**
 * 模块名:发布区操作日志
 * 代码描述:
 * 作者:张泽源
 * 创建时间:2024/12/19 09:19:28
 */
export function getLogColumns(): BasicColumn[] {
  return [
    {
      title: t('routes.table.documentReleaseArea.operationList.documentCode'),
      dataIndex: 'oid',
      fixed: 'left',
      width: 300,
    },
    {
      title: t('routes.table.documentReleaseArea.operationList.version'),
      dataIndex: 'docrevision',
      width: 100,
    },
    {
      title: t('routes.table.documentReleaseArea.operationList.operationAction'),
      dataIndex: 'action',
      width: 100,
    },
    {
      title: t('routes.table.documentReleaseArea.operationList.time'),
      dataIndex: 'bitime',
      width: 100,
      slots: { customRender: 'bitime' },
    },
    {
      title: t('routes.table.documentReleaseArea.operationList.user'),
      dataIndex: 'biuser',
      width: 100,
    },
  ];
}

/**
 * 模块名:创建发布区
 * 代码描述:
 * 作者:张泽源
 * 创建时间:2024/12/25 14:15:23
 */
export function AddRelForm(): FormSchema[] {
  return [
    {
      field: `startTime`,
      label: t('routes.table.documentReleaseArea.ReleaseList.startTime'),
      component: 'DatePicker',
      colProps: {
        xl: 12,
        xxl: 12,
      },
      required: true,
    },
    {
      field: `deadline`,
      label: t('routes.table.documentReleaseArea.ReleaseList.endTime'),
      component: 'DatePicker',
      colProps: {
        xl: 12,
        xxl: 12,
      },
      required: true,
    },
    {
      field: 'userOrRoleIds',
      component: 'Select',
      label: t('routes.table.documentReleaseArea.ReleaseList.receiver'),
      colProps: {
        xl: 12,
        xxl: 12,
      },
      required: true,
      componentProps: {
        placeholder: t('routes.table.documentReleaseArea.ReleaseList.receiverPlaceholder'),
        mode: 'multiple',
        maxTagCount: 5,
      },
    },
  ];
}

export function getRelColumns(): BasicColumn[] {
  return [
    {
      title: t('routes.demo.documentWorkPlace.documentWorkPlaceTableSet.fileName'),
      dataIndex: 'name',
      width: 250,
      align: 'left',
    },
    {
      title: t('routes.demo.documentWorkPlace.documentWorkPlaceTableSet.version'),
      dataIndex: 'version',
      width: 50,
    },
    {
      title: t('routes.demo.documentManager.tableData.fileType'),
      dataIndex: 'doctype',
      width: 150,
    },
  ];
}

/**
 * 模块名:收回发布文档
 * 代码描述:
 * 作者:张泽源
 * 创建时间:2025/01/08 15:41:11
 */
export function BasicDocForm(): FormSchema[] {
  return [
    {
      field: 'filename',
      component: 'Input',
      label: t('routes.table.documentReleaseArea.versionList.documentName'),
      componentProps: {
        disabled: true,
      },
      colProps: {
        xl: 12,
        xxl: 12,
      },
    },
    {
      field: 'thitObjectId',
      component: 'Input',
      label: t('routes.table.documentReleaseArea.versionList.documentCode'),
      componentProps: {
        disabled: true,
      },
      colProps: {
        xl: 12,
        xxl: 12,
      },
    },
    {
      field: 'docVersion',
      component: 'Input',
      label: t('routes.table.documentReleaseArea.versionList.version'),
      componentProps: {
        disabled: true,
      },
      colProps: {
        xl: 12,
        xxl: 12,
      },
    },
    {
      field: 'docType',
      component: 'Input',
      label: t('routes.table.documentReleaseArea.versionList.fileType'),
      componentProps: {
        disabled: true,
      },
      colProps: {
        xl: 12,
        xxl: 12,
      },
    },
  ];
}

export function getRetrieveColumns(): BasicColumn[] {
  return [
    {
      title: t('routes.table.documentReleaseArea.ReleaseList.publisher'),
      dataIndex: 'fUserId',
      width: 150,
      align: 'left',
    },
    {
      title: t('routes.table.documentReleaseArea.ReleaseList.receiver'),
      dataIndex: 'sUserId',
      width: 150,
    },
    {
      title: t('routes.table.documentReleaseArea.ReleaseList.releaseTime'),
      dataIndex: 'releaseTime',
      width: 150,
      slots: { customRender: 'releaseTime' },
    },
    {
      title: t('routes.table.documentReleaseArea.ReleaseList.endTime'),
      dataIndex: 'endTime',
      width: 150,
      slots: { customRender: 'endTime' },
    },
    {
      title: t('routes.table.documentReleaseArea.ReleaseList.originalPublisher'),
      dataIndex: 'fristUserId',
      width: 150,
    },
  ];
}
